import java.util.Scanner;
/**/
public class Text {
    public static int change(int n){
        if(n==0)return n;
        if(n==1||n==2)return 1;
        int[] res=new int[n+1];
        res[0]=0;
        res[1]=1;
        res[2]=1;
        for(int i=3;i<n+1;i++){
            res[i]=res[i-1]+res[i-2]+res[i-3];
        }
        return res[n];
    }
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int t=change(n);
        System.out.println(t);
    }
}
